package day03;

import java.util.Arrays;
import java.util.StringJoiner;

public class StringBuilderDemo {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3};
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (int i = 0; i < arr.length; i++) {
            if (i == arr.length - 1) {
                sb.append(arr[i]);
            } else {
                sb.append(arr[i] + ", ");
            }
        }
        sb.append("]");
        System.out.println(sb);
        System.out.println(Arrays.toString(arr));
        StringJoiner sj = new StringJoiner("-", "<", ">");
        for (int i = 0; i < arr.length; i++) {
            sj.add(arr[i]+"");
        }
        System.out.println(sj);
    }
}
